package com.learn.word.controller;

import com.learn.word.bean.ProblemSelectOne;
import com.learn.word.entity.Problem;
import com.learn.word.service.IProblem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Valley
 * Description
 * Created by Valley on 2023/6/19 20:20
 */
@RestController
@RequestMapping("problem")
@CrossOrigin
public class ProblemController {

    @Autowired
    IProblem problemService;

    @PostMapping("submit")
    public String submit(@RequestBody Problem problem){
        problemService.save(problem);
        return "success";
    }

    @GetMapping("selectList")
    public List<ProblemSelectOne> selectOne(Long id){
        return problemService.selectList(id);
    }

}